bitset<10001> v[50];
void solve()
{
  int n, m;
  cin >> n >> m;

  rep(i, 0, n - 1) {
    int k, x;
    cin >> k;
    rep(j, 1, k) {
      cin >> x;
      v[i][x] = 1;
    }
  }

  bool ok = true;
  rep(i, 0, n - 1) {
    rep(j, 0, n - 1) {
      if (!(v[i] & v[j]).count()) {
        ok = false;
        break;
      }
    }
  }

  if (ok) {
    cout << "possible";
  } else {
    cout << "impossible";
  }
}